package com.xiaozhen.mqtt.server;

import net.dreamlu.iot.mqtt.spring.server.MqttServerTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.nio.ByteBuffer;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/11/3 15:27
 * @description:
 */
@Service
public class ServerService {

    @Autowired
    private MqttServerTemplate server;

    public boolean publish(String body) {
        server.publishAll("/test/123", ByteBuffer.wrap(body.getBytes()));
        return true;
    }

}
